from rest_framework.throttling import AnonRateThrottle,UserRateThrottle
from rest_framework.pagination import PageNumberPagination
from django_filters import filterset,filters
from rest_framework.views import exception_handler

class MyAnonRate(AnonRateThrottle):
    rate='3/minute'

class MyUserRate(UserRateThrottle):
    rate='5/minute'

class Page(PageNumberPagination):
    page_size = 1

class BookFitlerSet(filterset.FilterSet):
    maxbook=filters.NumberFilter(field_name='name',lookup_expr='gt',label='最小值')
    minbook=filters.NumberFilter(field_name='name',lookup_expr='lt',label='最大值')


def  my_exception_handler(exec,context):
    print("我是异常！！！")
    return exception_handler(exec,context)